home *** CD-ROM | disk | FTP | other *** search
/ Resource for Source: C/C++ / Resource for Source - C-C++.iso / codelib9 / v_11_07 / 1107106a < prev    next >
Encoding:
Text File  |  1995-11-01  |  411 b   |  22 lines

  1. // adjust.cpp:  Justify output
  2. #include <iostream.h>
  3. #include <iomanip.h>
  4.  
  5. main()
  6. {
  7.     cout << '|' << setw(10) << "hello" << '|' << endl;
  8.  
  9.     cout.setf(ios::left,ios::adjustfield);
  10.     cout << '|' << setw(10) << "hello" << '|' << endl;
  11.  
  12.     cout.fill('#');
  13.     cout << '|' << setw(10) << "hello" << '|' << endl;
  14.     return 0;
  15. }
  16.  
  17. // Output
  18. // |     hello|
  19. // |hello     |
  20. // |hello#####|
  21.  
  22.